package com.zkthink.ceres.msgs.entity;

import cn.afterturn.easypoi.excel.annotation.Excel;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.zkthink.base.entity.Entity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;

import java.time.LocalDateTime;

import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
import static com.zkthink.utils.DateUtils.DEFAULT_DATE_TIME_FORMAT;

/**
 * <p>
 * 实体类
 *
 * </p>
 *
 * @author ck
 * @since 2022-02-28
 */
@Data
@NoArgsConstructor
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("ceres_push_msgs")
@ApiModel(value = "CeresPushMsgs", description = "消息弹窗推送记录")
@AllArgsConstructor
public class CeresPushMsgs extends Entity<Long> {

    private static final long serialVersionUID = 1L;

    /**
     * 发送人id
     */
    @ApiModelProperty(value = "发送人id")
    @TableField("mid")
    @Excel(name = "发送人id")
    private Long mid;

    /**
     * 消息类型
     */
    @ApiModelProperty(value = "消息类型")
    @TableField("msg_type")
    @Excel(name = "消息类型")
    private Integer msgType;

    /**
     * 消息内容
     */
    @ApiModelProperty(value = "消息内容")
    @Length(max = 65535, message = "消息内容长度不能超过65535")
    @TableField("content")
    @Excel(name = "消息内容")
    private String content;

    /**
     * 接收人id
     */
    @ApiModelProperty(value = "接收人id")
    @TableField("rreceive_id")
    @Excel(name = "接收人id")
    private Long rreceiveId;

    /**
     * 房间id
     */
    @ApiModelProperty(value = "房间id")
    @Length(max = 20, message = "房间id长度不能超过20")
    @TableField(value = "room_id", condition = LIKE)
    @Excel(name = "房间id")
    private String roomId;

    @ApiModelProperty(value = "推送内容")
    @Length(max = 20, message = "推送内容")
    @TableField(value = "push_content", condition = LIKE)
    @Excel(name = "推送内容")
    private String pushContent;

    /**
     * 发送人的昵称
     */
    @ApiModelProperty(value = "发送人的昵称")
    @Length(max = 255, message = "发送人的昵称长度不能超过255")
    @TableField(value = "nickname", condition = LIKE)
    @Excel(name = "发送人的昵称")
    private String nickname;

    /**
     * 发送人的头像
     */
    @ApiModelProperty(value = "发送人的头像")
    @Length(max = 255, message = "发送人的头像长度不能超过255")
    @TableField(value = "headimg", condition = LIKE)
    @Excel(name = "发送人的头像")
    private String headimg;

    /**
     * 推送时间
     */
    @ApiModelProperty(value = "推送时间")
    @TableField("push_time")
    @Excel(name = "推送时间", format = DEFAULT_DATE_TIME_FORMAT, width = 20)
    private LocalDateTime pushTime;

    /**
     * 推送类型:0:主动推送到消息弹窗1:是接口查询的
     */
    @ApiModelProperty(value = "推送类型:0:主动推送到消息弹窗1:是接口查询的")
    @TableField("push_type")
    @Excel(name = "推送类型:0:主动推送到消息弹窗1:是接口查询的")
    private Integer pushType;

    /**
     * 标题
     */
    @ApiModelProperty(value = "标题")
    @Length(max = 65535, message = "标题长度不能超过65535")
    @TableField("title")
    @Excel(name = "标题")
    private String title;

    @ApiModelProperty(value = "是否已读")
    @TableField("is_read")
    @Excel(name = "是否已读")
    private Integer isRead;


    @Builder
    public CeresPushMsgs(Long id, LocalDateTime createTime, Long createUser, LocalDateTime updateTime, Long updateUser,
                         Long mid, Integer msgType, String content, Long rreceiveId, String roomId,
                         String nickname, String headimg, LocalDateTime pushTime, Integer pushType, String title, Integer isRead, String pushContent) {
        this.pushContent = pushContent;
        this.isRead = isRead;
        this.id = id;
        this.createTime = createTime;
        this.createUser = createUser;
        this.updateTime = updateTime;
        this.updateUser = updateUser;
        this.mid = mid;
        this.msgType = msgType;
        this.content = content;
        this.rreceiveId = rreceiveId;
        this.roomId = roomId;
        this.nickname = nickname;
        this.headimg = headimg;
        this.pushTime = pushTime;
        this.pushType = pushType;
        this.title = title;
    }

}
